GDK-Win32: Move some functions around
authorChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 3 Aug 2020 10:22:51 +0000 (18:22 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 5 Aug 2020 07:38:08 +0000 (15:38 +0800)
Move gdk_win32_surface_get_queued_window_rect() and
gdk_win32_surface_apply_queued_move_resize() to gdksurface-win32.c, since these
functions are not only used for Cairo draw contexts, but is also used for GL
draw contexts, and will be used for Vulkan draw contexts.

gdk/win32/gdkcairocontext-win32.c
gdk/win32/gdksurface-win32.c

index 41b54deb3dfe4affa0f1cc59ccc141f0cd0591b2..fa3b834faee60f4c6ce1163631eacf1361878421 100644 (file)
 
 G_DEFINE_TYPE (GdkWin32CairoContext, gdk_win32_cairo_context, GDK_TYPE_CAIRO_CONTEXT)
 
-void
-gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
-                                          int         scale,
-                                          RECT       *return_window_rect)
-{
-  RECT window_rect;
-  GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
-
-  _gdk_win32_get_window_client_area_rect (surface, scale, &window_rect);
-
-  /* Turn client area into window area */
-  _gdk_win32_adjust_client_rect (surface, &window_rect);
-
-  /* Convert GDK screen coordinates to W32 desktop coordinates */
-  window_rect.left -= _gdk_offset_x * impl->surface_scale;
-  window_rect.right -= _gdk_offset_x * impl->surface_scale;
-  window_rect.top -= _gdk_offset_y * impl->surface_scale;
-  window_rect.bottom -= _gdk_offset_y * impl->surface_scale;
-
-  *return_window_rect = window_rect;
-}
-
-void
-gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface,
-                                            RECT        window_rect)
-{
-  if (!IsIconic (GDK_SURFACE_HWND (surface)))
-    {
-      GDK_NOTE (EVENTS, g_print ("Setting window position ... "));
-
-      API_CALL (SetWindowPos, (GDK_SURFACE_HWND (surface),
-                               SWP_NOZORDER_SPECIFIED,
-                               window_rect.left, window_rect.top,
-                               window_rect.right - window_rect.left,
-                               window_rect.bottom - window_rect.top,
-                               SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW));
-
-      GDK_NOTE (EVENTS, g_print (" ... set window position\n"));
-
-      return;
-    }
-
-  /* Don't move iconic windows */
-  /* TODO: use SetWindowPlacement() to change non-minimized window position */
-}
-
 static cairo_surface_t *
 create_cairo_surface_for_layered_window (GdkWin32Surface  *impl,
                                          int                   width,
index ca8b765113875fe1d0f8da3a06cd82c7d9ec72f9..357bfd813ed8a9aa04c71093401cccc6a33b783f 100644 (file)
@@ -5101,3 +5101,49 @@ _gdk_win32_surface_get_egl_surface (GdkSurface *surface,
 
 }
 #endif
+
+void
+gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
+                                          int         scale,
+                                          RECT       *return_window_rect)
+{
+  RECT window_rect;
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
+
+  _gdk_win32_get_window_client_area_rect (surface, scale, &window_rect);
+
+  /* Turn client area into window area */
+  _gdk_win32_adjust_client_rect (surface, &window_rect);
+
+  /* Convert GDK screen coordinates to W32 desktop coordinates */
+  window_rect.left -= _gdk_offset_x * impl->surface_scale;
+  window_rect.right -= _gdk_offset_x * impl->surface_scale;
+  window_rect.top -= _gdk_offset_y * impl->surface_scale;
+  window_rect.bottom -= _gdk_offset_y * impl->surface_scale;
+
+  *return_window_rect = window_rect;
+}
+
+void
+gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface,
+                                            RECT        window_rect)
+{
+  if (!IsIconic (GDK_SURFACE_HWND (surface)))
+    {
+      GDK_NOTE (EVENTS, g_print ("Setting window position ... "));
+
+      API_CALL (SetWindowPos, (GDK_SURFACE_HWND (surface),
+                               SWP_NOZORDER_SPECIFIED,
+                               window_rect.left, window_rect.top,
+                               window_rect.right - window_rect.left,
+                               window_rect.bottom - window_rect.top,
+                               SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW));
+
+      GDK_NOTE (EVENTS, g_print (" ... set window position\n"));
+
+      return;
+    }
+
+  /* Don't move iconic windows */
+  /* TODO: use SetWindowPlacement() to change non-minimized window position */
+}